`:top
`!math.h`! ist eine `F33f`_`[Header-Datei`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Header-Datei]`_`f in der `F33f`_`[Standard C Library`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Standard_C_Library]`_`f der `F33f`_`[Programmiersprache C`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=C_(Programmiersprache)]`_`f. Sie wurde für mathematische Funktionen entwickelt. Die `F33f`_`[Programmiersprache C++`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=C++]`_`f benutzt die Funktionen ebenfalls, um die Kompatibilität von C zu C++ zu gewährleisten, und deklariert sie in der Header-Datei `!cmath`! (dort ohne die `F33f`_`[Dateinamenserweiterung`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Dateinamenserweiterung]`_`f „.h“ verwendet).
Alle Funktionen, die einen Winkel einlesen oder ausgeben, arbeiten mit `F33f`_`[Radiant`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Radiant_(Einheit)]`_`f. Die meisten Funktionen arbeiten mit `F33f`_`[Gleitkommazahlen`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Gleitkommazahlen]`_`f. Mathematische Funktionen, die mit ganzzahligen Werten (`F33f`_`[Integer`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Integer_(Datentyp)]`_`f) arbeiten, wie abv, labs, div oder ldiv, sind stattdessen in der Header-Datei `F33f`_`[stdlib.h`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Stdlib.h]`_`f vertreten.
>>Contents
• `F0af`_`[Funktionen bis C95`#funktionen-bis-c95]`_`f
• `F0af`_`[C99-Funktionen`#c99-funktionen]`_`f
• `F0af`_`[Beispiel`#beispiel]`_`f
• `F0af`_`[Weblinks`#weblinks]`_`f
-─
>>Funktionen bis C95
In den Normen bis einschließlich `F33f`_`[C95`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=C95]`_`f waren die folgenden Funktionen `F33f`_`[deklariert`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Deklaration_(Programmierung)]`_`f.
`t
| Name | Beschreibung | Mathematische Formulierung |
|---|---|---|
| acos | Arkuskosinus | arccos x {\\displaystyle \\arccos x} |
| asin | Arkussinus | arcsin x {\\displaystyle \\arcsin x} |
| atan | Arkustangens | arctan x {\\displaystyle \\arctan x} |
| atan2 | „Arkustangens“ mit zwei Argumenten | atan2 ( y , x ) {\\displaystyle \\operatorname {atan2} (y,x)} |
| ceil | Aufrundungsfunktion | ⌈ x ⌉ {\\displaystyle \\lceil x\\rceil } |
| cos | Kosinus | cos x {\\displaystyle \\cos x} |
| cosh | Kosinus hyperbolicus | cosh x {\\displaystyle \\cosh x} |
| exp | Exponentialfunktion | e x {\\displaystyle e^{x}} |
| fabs | Betragsfunktion | / x / {\\displaystyle /x/} |
| floor | Ganzteilfunktion | ⌊ x ⌋ {\\displaystyle \\lfloor x\\rfloor } |
| fmod | Führt die Modulo -Funktion für Gleitkommazahlen durch | x mod y {\\displaystyle x{\\bmod {y}}} |
| frexp | Teilt eine Gleitkommazahl in Faktor und Potenz mit der Basis 2 auf | |
| ldexp | Multipliziert den ersten Parameter mit 2 um den zweiten Parameter potenziert | x 2 y {\\displaystyle x2^{y}} |
| log | Natürlicher Logarithmus | ln x {\\displaystyle \\ln x} |
| log10 | Logarithmus zur Basis 10 | log 10 x {\\displaystyle \\log _{10}x} |
| modf | Teilt eine Gleitkommazahl in zwei Zahlen auf, vor und nach dem Komma | |
| pow | Potenziert ersten mit dem zweiten Parameter | x y {\\displaystyle x^{y}} |
| sin | Sinus | sin x {\\displaystyle \\sin x} |
| sinh | Sinus hyperbolicus | sinh x {\\displaystyle \\sinh x} |
| sqrt | Quadratwurzel | x {\\displaystyle {\\sqrt {x}}} |
| tan | Tangens | tan x {\\displaystyle \\tan x} |
| tanh | Tangens hyperbolicus | tanh x {\\displaystyle \\tanh x} |
`t
>>C99-Funktionen
Mit der Norm `F33f`_`[C99`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Varianten_der_Programmiersprache_C]`_`f wurde math.h um die folgenden Funktionen erweitert.
`t
| Name | Beschreibung | Mathematische Formulierung |
|---|---|---|
| acosh | Areakosinus hyperbolicus | arcosh x {\\displaystyle \\operatorname {arcosh} x} |
| asinh | Areasinus hyperbolicus | arsinh x {\\displaystyle \\operatorname {arsinh} x} |
| atanh | Areatangens hyperbolicus | artanh x {\\displaystyle \\operatorname {artanh} x} |
| cbrt | Kubikwurzel | x 3 {\\displaystyle {\\sqrt[{3}]{x}}} |
| copysign( x , y ) | gibt den Wert von x mit dem Vorzeichen von y zurück | / x / ⋅ sgn y {\\displaystyle /x/\\cdot \\operatorname {sgn} y} |
| erf | Fehlerfunktion | erf x {\\displaystyle \\operatorname {erf} x} |
| erfc | Gibt den Komplementärfehler von x zurück | erfc x {\\displaystyle \\operatorname {erfc} x} |
| exp2( x ) | Potenziert 2 mit dem übergebenen Parameter | 2 x {\\displaystyle 2^{x}} |
| expm1( x ) | Liefert den Wert von exp()-1 zurück | e x − 1 {\\displaystyle e^{x}-1} |
| fdim( x , y ) | Positive Differenz | max ( 0 , x − y ) {\\displaystyle \\max(0,x-y)} |
| fma( x , y , z ) | Multipliziert und Addiert | x y + z {\\displaystyle xy+z} |
| fmax( x , y ) | Maximum | max ( x , y ) {\\displaystyle \\max(x,y)} |
| fmin( x , y ) | Minimum | min ( x , y ) {\\displaystyle \\min(x,y)} |
| hypot( x , y ) | Hypotenuse | ( x 2 + y 2 ) {\\displaystyle {\\sqrt {(x^{2}+y^{2})}}} |
| ilogb | wie logb , gibt allerdings int zurück | (int)logb(x) |
| lgamma | Logarithmus der Gammafunktion | ln / Γ ( x ) / {\\displaystyle \\ln /\\Gamma (x)/} |
| llrint | Rundungsfunktion | |
| lrint | Rundungsfunktion | |
| llround | Rundungsfunktion | |
| lround | Rundungsfunktion | |
| log1p( x ) | Natürlicher Logarithmus von 1 + x | ln ( 1 + x ) {\\displaystyle \\ln(1+x)} |
| log2 | Logarithmus zur Basis 2 | lb x {\\displaystyle \\operatorname {lb} x} |
| logb | Liefert den ganzzahligen Exponenten einer Gleitkommazahl als Gleitkommazahl | rint ( log F L T _ R A D I X / x / ) {\\displaystyle \\operatorname {rint} (\\log _{\\mathrm {FLT\\_RADIX} }/x/)} |
| nan( s ) | Ein NaN erzeugen | 0 / 0 {\\displaystyle 0/0} |
| nearbyint | Rundet Gleitkommazahlen zum nächsten Integer | |
| nextafter( x , y ) | Gibt die nächst darstellbare Zahl nach x (Richtung y ) zurück | |
| nexttoward( x , y ) | Wie nextafter , außer dass y als long double übergeben wird | |
| remainder( x , y ) | Rest einer Division | |
| remquo( x , y , p ) | Genauso wie remainder , speichert jedoch den Quotienten (als int ) als Ziel des Zeigers p | |
| rint | Rundet je nach Rundungsmodus zum nächsten Integer, gibt eine Gleitkommazahl zurück | |
| round | kaufmännische Rundungsfunktion | ⌊ x + 0 , 5 ⌋ {\\displaystyle \\lfloor x+0{,}5\\rfloor } |
| scalbln( x , y ) | x * FLT_RADIX y ( y ist long ) | x ⋅ F L T _ R A D I X y {\\displaystyle x\\cdot \\mathrm {FLT\\_RADIX} ^{y}} |
| scalbn( x , y ) | x * FLT_RADIX y ( y ist int ) | x ⋅ F L T _ R A D I X y {\\displaystyle x\\cdot \\mathrm {FLT\\_RADIX} ^{y}} |
| tgamma | Gammafunktion | Γ ( x ) {\\displaystyle \\Gamma (x)} |
| trunc | Beschneidet eine Gleitkommazahl, d. h. rundet „Richtung Null“ | { ⌊ x ⌋ , x ≥ 0 ⌈ x ⌉ , x < 0 {\\displaystyle {\\begin{cases}\\lfloor x\\rfloor ,&x\\geq 0\\\\\\lceil x\\rceil ,&x<0\\end{cases}}} |
`t
>>Beispiel
`B100`F9d9#include <stdio.h>`f`b
`B100`F9d9#include <math.h>`f`b
`B100`F9d9`f`b
`B100`F9d9int main() {`f`b
`B100`F9d9 double a = 5, b = 4;`f`b
`B100`F9d9 double c = pow(a, b);`f`b
`B100`F9d9 printf("%f hoch %f ist %f\\n", a, b, c);`f`b
`B100`F9d9}`f`b
>>Weblinks
• `*Rationale for International Standard – Programming Languages – C.`* (PDF, 898 kB) Abgerufen am 4. September 2011 (C99).
• Beschreibung auf cplusplus.com (englisch)
• Dokumentation von math.h auf dinkumware.com (`F33f`_`[Memento`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Webarchivierung]`_`f vom 21. Februar 2010 im `*`F33f`_`[Internet Archive`:/page/entry.mu`zim=wikipedia_de_all_nopic_2026-01.zim|entry_path=Internet_Archive]`_`f`*)
`c`F0af`_`[↑ Back to top`#top]`_`f`a